import time

def display_progress(scale, interval=0.1):
    start = time.perf_counter()  # 开始时间

    for i in range(scale + 1):
        a = '*' * i
        b = '.' * (scale - i)
        c = (i / scale) * 100
        dur = time.perf_counter() - start  # 计算已经过去的时间
        print(f"\r{c:6.2f}% [{'*' * i}{'.' * (scale - i)}] {dur:.2f}s", end='')
        time.sleep(interval)  # 休眠以减缓更新速度

    print()  # 确保最后输出不会被下一行输出覆盖

scale = 50
display_progress(scale, interval=0.1)
